home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / public / fax / src / doc / hayes.txt < prev    next >
Text File  |  1994-08-01  |  84KB  |  1,811 lines

  1.  
  2. TECHNICAL REFERENCE FOR HAYES (TM) MODEM USERS
  3.  
  4. 15 Sept 1992
  5. Version P2.0
  6.  
  7. Hayes Microcomputer Products, Inc.
  8. P.O. Box 105203
  9. Atlanta, Georgia 30348 U.S.A.
  10.  
  11. (c) 1990, 1992 Hayes Microcomputer Products, Inc.
  12. All rights reserved.
  13.  
  14. 44-00012 AA H32 (BBS Version)
  15. Note: This version of the "Technical Reference for Hayes Modem Users" is a 
  16. special version edited for bulletin-board downloading. As a plain ASCII 
  17. character file, it therefore cannot contain any of the illustrations and 
  18. graphic elements provided in the printed version.
  19.  
  20. ------------------------------------------------------------------------
  21.  
  22. I - Internal Memory Tests
  23.  
  24. The various forms of the I command instruct the modem to query its 
  25. memory for information about itself. The results of these tests are 
  26. frequently used by programmers to determine compatibility with software. 
  27. Because these commands request information about the modem's firmware, 
  28. they are not run when a connection has been established with a remote 
  29. modem.
  30.  
  31. I0 - Display Product Code
  32.  
  33. This option reports the product code of the modem to the DTE. The modem 
  34. produces information text dependent upon its highest DCE line speed. The 
  35. responses below are examples:
  36.  
  37. Result Codes     Description
  38. ------------------------------------------------------------------------
  39. 300              Smartmodem 300.
  40. 120              Smartmodem 1200, Smartmodem 1200B, Smartmodem 1200C, 
  41.                  Smartmodem 1200A.
  42. 240              Smartmodem 2400, Smartmodem 2400B, Smartmodem 2400P, 
  43.                  Smartmodem 2400Q, Smartmodem 2400M, V-series Smartmodem 
  44.                  2400, V-series Smartmodem 2400B, V-series Smartmodem 
  45.                  2400 Quad, V-series Smartmodem 2400M, Smartmodem OPTIMA 
  46.                  (TM) 24, Smartmodem OPTIMA 24 + FAX96, 
  47.                  ACCURA (TM) 2400 EC/FAX96.
  48. 960              Smartmodem 9600, V-series Smartmodem 9600, V-series 
  49.                  Smartmodem 9600B, V-series ULTRA (TM) Smartmodem 2400, 
  50.                  V-series ULTRA Smartmodem 9600, V-series ULTRA 24 with 
  51.                  Express 96, Smartmodem OPTIMA 9600, Smartmodem 
  52.                  OPTIMA 96 + FAX96, ACCURA 9600 EC/FAX96.  
  53. 14400            V-series ULTRA Smartmodem 14400, Smartmodem OPTIMA 144, 
  54.                  Smartmodem OPTIMA 144 + FAX144, ACCURA 14400 EC/FAX144. 
  55. ------------------------------------------------------------------------
  56.  
  57. I1- Display ROM Checksum
  58.  
  59. The I1 command instructs the modem to calculate the value of the ROM 
  60. checksum. The response is a number, the sum of all of the bytes in ROM.
  61.  
  62. I2 - Perform ROM Checksum
  63.  
  64. This command instructs the modem to verify the ROM checksum. Depending 
  65. on whether the ROM checksum has been found to be correct, the modem 
  66. produces text that resembles a result code. The modem memory test 
  67. compares the ROM checksum and tests it against the correct sum, also 
  68. stored in ROM. Rather than returning a numeric value as in I1, the I2 
  69. command generates a result code. When the checksum is valid, the 
  70. response is: OK. When the ROM checksum fails, the modem responds with 
  71. ERROR.
  72.  
  73. I4 -  Identify Product Features
  74.  
  75. The capabilities and features of the modem are encoded into a string of 
  76. text that consists of several strings that are ASCII character 
  77. representations of hex numerals which are bit-mapped. The first 
  78. character of each string identifies which bit maps are in that string. 
  79. For example, the "a-string" starts with a lower case "a" and identifies 
  80. most of the basic modem capabilities such as modulation standards 
  81. supported and support for AutoSync.
  82.  
  83. Since the following tables identify features for Hayes modem products, 
  84. the values included here and the number of strings are subject to change 
  85. and expansion. The maximum length per string is 40 characters.
  86.  
  87. The I4 text is displayed in the following form:
  88.  
  89.      a097800C204C264
  90.      bF60410000
  91.      r1031111111010000
  92.      r3000111010000000
  93.  
  94. surrounded by additional <CR> and <LF> characters as are required by the 
  95. V command option in effect. According to convention, all <CR> and <LF> 
  96. characters are defined by S3 and S4, respectively. The meanings of the 
  97. a, b, r1, and r3 strings currently defined are described below.
  98.  
  99. I4 "a" String
  100. The first string, the a-string, is composed of the ASCII character "a" 
  101. followed by a series of hexadecimal characters (D1-D16 in this example). 
  102. The bit map for each byte is defined below.
  103.  
  104. a D1 D2 D3 D4 D5 D6 D7 D8 D9 D10 D11 D12 D13 D14 D15 D16 D17 D18....
  105.  
  106. ------------------------------------------------------------------------
  107. D1, D2     Reserved
  108. D3         Bit 3: Indicates modem based on SM1200FE commands 
  109.            Bit 2: Indicates modem based on SM2400 commands 
  110.            Bit 1: Indicates that modem supports &J commands
  111.            Bit 0: Indicates that modem supports &L commands 
  112. D4         Bit 3: Indicates that modem supports AutoSync (&Q4)
  113. D5         Bit 3: Plug-in board modem product
  114.            Bit 2: Standalone modem product
  115.            Bit 1: Supports &H0 through &H4
  116.            Bit 0: Supports &I0 through &I4 
  117. D6         Bit 3: Reserved
  118.            Bit 2: Supports M4 command
  119.            Bit 1: Supports 32-bit FCS (frame check sequence 
  120.            for AutoSync)
  121.            Bit 0: Supports AutoSync II
  122. D7         Bit 3: Supports V.22 at 1200 bps (B0)
  123.            Bit 2: Supports 212A (B1)
  124.            Bit 1: Supports ASB in V.23 75 bps xmt/1200 bps rcv (B2)
  125.            Bit 0: Supports ASB in V.23 1200 bps xmt/75rcv (B3)
  126. D8         Bit 3: Supports V.23 1200 bps xmt/75 bps rcv (B4)
  127.            Bit 2: Supports V.23 1200 half duplex (B5)
  128.            Bit 1: Supports V.23 75 bps xmt/1200 bps rcv (B10)
  129.            Bit 0: Supports V.23 75 bps xmt/600 bps rcv  (B11)
  130. D9         Bit 3: Supports V.21 100/300 bps (B15)
  131.            Bit 2: Supports ASB in V.23 75 bps xmt/600 bps rcv (B20)
  132.            Bit 1: Supports ASB in V.23 600 bps xmt/75 bps rcv (B21)
  133.            Bit 0: Supports V.23 600 bps xmt/75 bps rcv  (B22)
  134. D10        Bit 3: Supports V.23 600 bps half-duplex (B23)
  135.            Bit 2: Supports V.22bis at 2400 bps (B30)
  136.            Bit 1: Supports V.27ter at 2400 bps (B31)
  137.            Bit 0: Supports V.27ter at 4800 bps  (B40)
  138. D11        Bit 3: Supports V.32 full duplex at 4800 bps (B41)
  139.            Bit 2: Supports Express 96 at 4800 bps (B42)
  140.            Bit 1: Reserved
  141.            Bit 0: Supports V.29 half duplex at 4800 bps (B44)
  142. D12        Bit 3: Supports V.29 half duplex at 7200 bps (B50)
  143.            Bit 2: Supports V.32 full duplex at 9600 bps (B60)
  144.            Bit 1: Supports Express 96 at 9600 bps (B61)
  145.            Bit 0: Reserved
  146. D13        Bit 3: Supports V.29 half duplex at 9600 bps (B63)
  147.            Bit 2: Supports 103 110/300 bps (B16)
  148.            Bit 1: Supports V.32bis (7200/12000/14400 bps)
  149.            Bit 0: Reserved
  150. ------------------------------------------------------------------------
  151.  
  152. ------------------------------------------------------------------------
  153. D1, D2      Reserved
  154. D14         0: Reserved
  155.             1: Personal Modem 1200
  156.             2: Personal Modem 2400
  157.             3: Personal Modem 1200 Plus
  158.             4: Personal Modem 2400 Plus
  159.             5: Pocket Edition
  160. D15         Bit 3: Reserved
  161.             Bit 2: Supports $ dial modifier and NO DIALTONE result code.
  162.             Bit 1: Supports S95 Bit 5 for COMPRESSION: result code
  163.             Bit 0: Supports S95 Bit 4 for AUTOSTREAM: result code 
  164. D16         Bit 3: Supports S95 Bit 3 PROTOCOL: result code
  165.             Bit 2: Supports S95 Bit 2 CARRIER result code
  166.             Bit 1: Supports S95 Bit 1 CONNECT/ARQ result code
  167.             Bit 0: Supports S95 Bit 0 CONNECT XXXX (for DCE rate) 
  168. ------------------------------------------------------------------------
  169.  
  170. I4 "b" String
  171.  
  172. The second string, the b-string, is composed of the ASCII character "b" 
  173. followed by a series of hexadecimal characters (D1-D9). The bit map for 
  174. each character is defined as follows:
  175.  
  176. b D1 D2 D3 D4 D5 D6 D7 D8 D9....
  177.  
  178. ------------------------------------------------------------------------
  179. D1          Bit 3: V.42 Alternate Protocol Supported
  180.             Bit 2: V.42 LAPM Protocol Supported
  181.             Bit 1: X.25 Protocol Supported
  182.             Bit 0: LAPB (Point-to-point error control) protocol supported
  183. D2          Bit 3: Reserved (should be set to zero)
  184.             Bit 2 MNP (TM) Class 5 supported
  185.             Bit 1: V.42bis supported
  186.             Bit 0: Compression through the X.25 network supported
  187. D3/D4       These combine to indicate the number of AutoStream 
  188.             Type A channels which are supported. The formula 
  189.             (D3*16 + D4) is used. Zero means AutoStream is not supported
  190. D5          Bit 3: Reserved
  191.             Bit 2: Reserved
  192.             Bit 1: Adjustable startup (ASU) is supported
  193.             Bit 0: Negotiates adjustable startup
  194. D6          Bit 3: &K5 not supported
  195.             Bit 2: &K5 supported
  196.             Bit 1: Unidirectional flow control
  197.             Bit 0: S105 N104 parameter supported
  198. ------------------------------------------------------------------------
  199.  
  200. I4 "r1, r2" and "r3" strings
  201.  
  202. These ID strings allow software to determine the available speeds that 
  203. may be used to send AT commands. The r1-string contains a bit map that 
  204. indicates at which DTE rates the autobaud process is supported.
  205.  
  206. The presence of the r2-string in the I4 result infers that S87 is 
  207. supported and is required for autobauding at the higher speeds. To 
  208. autobaud at one of the speeds indicated in the r2-string requires that 
  209. S87 be set to match that speed. 
  210.  
  211. The r3-string is issued if synchronous DTE speeds are supported. The map 
  212. indicates which DTE rates are supported in synchronous modes. Each r-
  213. string begins with the lower case letter "r" and may be followed by as 
  214. many as 39 additional characters, not counting <CR><LF>'s that will be 
  215. used to separate them from other strings. Those 39 additional characters 
  216. are limited to the ASCII-HEX alphabet 0-9 and A-F.
  217.  
  218. After the two lead-in characters (i.e., r<n>), all subsequent characters 
  219. contain the DTE rate maps. All maps have the same mapping for 
  220. convenience to software. (Refer to the following chart.) Not all bit 
  221. assignments are possible: for example, the split speeds have no meaning 
  222. in the r3 synchronous map and are always filled with zeros.
  223.  
  224. In r1, if the bit is filled with a 1, the corresponding DTE rate is 
  225. supported for sending AT commands to the device. A zero indicates that 
  226. DTE rate is not supported for AT commands.
  227.  
  228. In the r3 map, the bits simply indicate which DTE rates are supported 
  229. for synchronous operation on-line. This does not indicate, however, the 
  230. supported rates for synchronous V.25bis commands.
  231.  
  232. Split speeds if available are marked in the r1 string only when the 
  233. appropriate B command option has been selected. Future expansion of 
  234. these strings may include new speeds that are not in strict ascending 
  235. order.
  236.  
  237. DTE Rate Bit Map for r1, r2 and r3 Strings
  238.  
  239. Character    Bit #       DTE Rate
  240. ------------------------------------------------------------------------
  241.  3:  1       bit 0       45.45 bps
  242.      2       bit 1       50
  243.      4       bit 2       75
  244.      8       bit 3       75/600 (xmt is 75, rcv is 600) 
  245.  4:  1       bit 4       75/1200
  246.      2       bit 5       110
  247.      4       bit 6       134.5
  248.      8       bit 7       50
  249.  5:  1       bit 8       300
  250.      2       bit 9       450
  251.      4       bit 10      600
  252.      8       bit 11      600/75
  253.  6:  1       bit 12      1200
  254.      2       bit 13      1200/75
  255.      4       bit 14      1800
  256.      8       bit 15      2000
  257.  7:  1       bit 16      2400
  258.      2       bit 17      3000
  259.      4       bit 18      3600
  260.      8       bit 19      4200
  261.  8:  1       bit 20      4800
  262.      2       bit 21      5400
  263.      4       bit 22      6000
  264.      8       bit 23      6600
  265.  9:  1       bit 24      7200
  266.      2       bit 25      7800
  267.      4       bit 26      8400
  268.      8       bit 27      9000
  269. 10:  1       bit 28      9600
  270.      2       bit 29      12000
  271.      4       bit 30      14400
  272.      8       bit 31      16800
  273. 11:  1       bit 32      19200
  274.      2       bit 33      21600
  275.      4       bit 34      24000
  276.      8       bit 35      26400
  277. 12:  1       bit 36      28800
  278.      2       bit 37      31200
  279.      4       bit 38      33600
  280.      8       bit 39      36000
  281. 13:  1       bit 40      38400
  282.      2       bit 41      43200
  283.      4       bit 42      48000
  284.      8       bit 43      52800
  285. 14:  1       bit 44      56000
  286.      2       bit 45      57600
  287.      4       bit 46      62400
  288.      8       bit 47      64000
  289. 15:  1       bit 48      67200
  290.      2       bit 49      72000
  291.      4       bit 50      76800
  292.      8       bit 51      81600
  293. 16:  1       bit 52      86400
  294.      2       bit 53      91200
  295.      4       bit 54      96000
  296.      8       bit 55      100800
  297. 17:  1       bit 56      105600
  298.      2       bit 57      110400
  299.      4       bit 58      115200
  300.      8       bit 59      reserved ("0")
  301. ------------------------------------------------------------------------
  302.  
  303. W - Negotiation Progress Message Selection
  304.  
  305. The W command works in conjunction with S95 (where supported) to 
  306. determine which result codes will be used to describe the type of 
  307. connection and protocol, etc., that resulted from handshaking and 
  308. negotiation. 
  309.  
  310. The W command supports extended result codes in addition to 
  311. the CONNECT result code. When the modem is operated in error-control 
  312. mode (&Q5 is in effect), the W command and S95 together allow the user 
  313. to select these additional result codes:
  314.  
  315. CARRIER
  316. PROTOCOL
  317. AUTOSTREAM
  318. COMPRESSION
  319. CONNECT
  320.  
  321. Any result codes enabled by the W command and S95 will be generated in 
  322. the order indicated above. If AutoStream is not being used, no 
  323. AUTOSTREAM result code is returned. Result codes not enabled when the W 
  324. command option is in effect may be turned on by setting certain bits in 
  325. S95. The W command options below are available when S95 is configured 
  326. for any setting other than the factory-setting of 0.
  327.  
  328. ------------------------------------------------------------------------
  329. W0     CONNECT result code reports DTE speed, and if S95=0, then disable
  330.        all extended result codes.
  331. W1     CONNECT result code reports DTE speed, and if S95=0, then enable
  332.        the CARRIER and PROTOCOL extended result codes.
  333. W2     CONNECT result code reports DCE speed, and if S95=0, then disable
  334.        all extended result codes.
  335. ------------------------------------------------------------------------
  336.  
  337. Refer to the S95 bit map description in the next section. Note that 
  338. selecting W0 and setting S95=12 is the same as selecting W1; and that 
  339. selecting W0 and setting S95=1 is the same as selecting W2. S95 cannot 
  340. be configured to force W2 to report DTE speed in the CONNECT result 
  341. code; there is no setting of S95 that will force W1 not to produce the 
  342. CARRIER and PROTOCOL result codes. S95 extends the functionality of the 
  343. W command. The W command with S95=0 (factory setting) maintains 
  344. backwards compatibility with previous Hayes Products. However, 
  345. selecting W0 and setting S95 as required allows you to tailor result 
  346. code characteristics to your own requirements.
  347.  
  348. ------------------------------------------------------------------------
  349.  
  350. Z - Soft Reset Command
  351.  
  352. The modem can be reset by issuing the Z command. The command tells the 
  353. modem to go on hook and restore the selected stored profile. Any non-
  354. storable parameters previously set by commands are returned to their 
  355. factory settings. The modem aborts execution of all commands following 
  356. the Z command on the same command line. Subsequent commands on the same 
  357. line are ignored. Refer to the &W command for description of which modem 
  358. parameters are included in a stored profile. Z0 recalls stored user 
  359. profile 0, stored with &W0; Z1 recalls stored user profile 1, stored 
  360. with &W1.
  361.  
  362. ------------------------------------------------------------------------
  363. Z0     Recall stored profile 0
  364. Z1     Recall stored profile 1
  365. ------------------------------------------------------------------------
  366.  
  367. &T19 - Perform RTS/CTS Cable Test
  368.  
  369. Software can use &T19 to help determine whether the DTE-to-Modem cable 
  370. supports the RTS and CTS signals necessary for hardware flow control, 
  371. which is selected by the &K3 command.
  372.  
  373. &T19 in the modem works interactively with the DTE to confirm the RTS 
  374. and CTS signal. Only the DTE can detect CTS, and only the modem can 
  375. detect RTS. The modem cannot verify both signals without the active 
  376. involvement of the DTE software.
  377.  
  378. The modem performs the following algorithm in response to the AT&T19<CR> 
  379. command:
  380.  
  381. 1.  Turns OFF CTS (normally ON).
  382. 2.  Starts a 500 millisecond timer.
  383. 3.  Monitors RTS for ON and OFF states.
  384. 4.  If both states of RTS are detected before the 500ms timer 
  385.     expires then:
  386.       a. Restore CTS to the ON state.
  387.       b. End the test (stop the timer).
  388.       c. Return the OK result code (meaning the modem has 
  389.       verified RTS).
  390. 5.  If the timer expires before both states of RTS are detected then:
  391.       a. Restore CTS to the ON state.
  392.       b. Return the ERROR result code (meaning the modem has not 
  393.       verified RTS).
  394.  
  395. Note: By itself, the modem cannot verify either signal. The DTE must 
  396. toggle RTS during the test in order for the modem to be able to detect a 
  397. change. Also, the DTE should look for CTS to drop during the test to 
  398. verify it is connected.
  399.  
  400. The following algorithm is used by Hayes Smartcom software in its use of 
  401. the &T19 test:
  402.  
  403. 1.  Issue AT&T19 <CR>
  404.  
  405. Note: For more predictable timing, do not combine other commands on the 
  406. same command line with &T19. Also, higher DTE port speeds improve the 
  407. timing resolution.
  408.  
  409. 2.  Wait 500ms for CTS to drop. If CTS does not drop in that time, then 
  410. the test fails.
  411.  
  412. 3.  If CTS drop is detected, then:
  413.       a. Drop RTS, wait 50ms, raise RTS, wait 50ms, repeat up to 6 
  414.       times, or until CTS is  detected high.
  415.       b. If CTS is detected returning high before 6 iterations, then the
  416.       test is passing (and an OK result code may be expected soon), or 
  417.       if all 6 iterations did not result in CTS being raised, then the 
  418.       RTS part of the test is failing (and an ERROR result code may be 
  419.       expected after the 500ms timer expires).
  420.  
  421. 4.  Process the result code from the modem. Success during Step 3 above 
  422.     and an OK result code implies that RTS and CTS are both wired 
  423.     correctly. Failure during Step 3 or an ERROR result code implies 
  424.     that either RTS or CTS is not wired in the cable.
  425.  
  426. Note: Keep in mind that the result code may arrive while you are still 
  427. in Steps 2 and 3 above.
  428.  
  429. A modification to the software algorithm could be made to permit 
  430. software to detect which signal is missing from the cable. After issuing 
  431. the AT&T19 <CR> command, give the modem about 100ms to drop CTS. Then, 
  432. even if the CTS drop is not detected, proceed to toggle RTS anyway, 
  433. keeping in mind that the CTS part of the test has failed.
  434.  
  435. RTS/CTS flow control is preferred because it is "out of band", that is, 
  436. it does not consume any of the 256 serial codes from the user data. 
  437. XON/XOFF flow control uses DC1 (ASCII 17) and DC3 (ASCII 19). If RTS/CTS 
  438. is not supported, then Transparent Flow Control (&K5) is the next best 
  439. option (IF the software supports it) because it accomplishes Xon/Xoff 
  440. flow control without interfering with the user data (e.g. during binary 
  441. file transfers).
  442.  
  443. ************************************************************************
  444. 1.2     Result Code Listing
  445.  
  446. This section defines the result codes returned by Hayes modems in 
  447. response to commands.
  448.  
  449. The table below shows the various formats in which modem responses can 
  450. be presented. Note that the "text" of the info-text may consist of 
  451. multiple lines of text. The formats depicted here only refer to the 
  452. <CR><LF> characters between info-texts and not within them.
  453.  
  454. ------------------------------------------------------------------------
  455.                   V0            V1
  456. Information Text  text          <CR><LF>
  457.                   <CR><LF>      text
  458.                                 <CR><LF>
  459. Result Codes      numeric code  <CR><LF>
  460.                   <CR>          verbose code
  461.                                 <CR><LF>
  462. ------------------------------------------------------------------------
  463.  
  464. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  465. 1.2.1     Command Response and Call Progress Monitoring
  466. This set of result codes includes responses to commands and call 
  467. progress monitoring responses. They are available to all modems within 
  468. the capabilities of the modem. For example, the result code CONNECT 9600 
  469. is not available to Smartmodem 2400. The factory setting for all high-
  470. speed modems enables the extended set of call progress monitoring (X4). 
  471. When set up in this way, the modem performs and reports full call 
  472. progress monitoring (RING, NO CARRIER, NO DIALTONE, and BUSY). It also 
  473. indicates the speed of the connection (CONNECT 1200 as opposed to simply 
  474. CONNECT). The factory setting for Smartmodem 300, Smartmodem 1200, and 
  475. all others whose highest speed is 1200 bps is basic call progress 
  476. monitoring (X0).
  477.  
  478. The command response and call progress monitoring result codes are 
  479. defined below:
  480.  
  481. 0 - OK
  482. This result code indicates that a command or command string was 
  483. executed. Note that if more than one command were included on a line and 
  484. an ERROR result code received, this means that one or more of the 
  485. commands was not processed. If one or more were executed properly, but 
  486. even one was invalid, no OK will be issued, only the ERROR.
  487.  
  488. 1 - CONNECT
  489. This result code indicates a connection was made between the DTE and the 
  490. modem. If X4 (extended set of call progress monitoring) were selected, 
  491. the code indicates that a connection from at 0 to 300 bps was made. 
  492. However, if X0 (basic set of call progress monitoring) were selected, 
  493. the connection could be 0-300, 1200, 1200/75, 75/1200, 2400, 4800, 7200, 
  494. 9600, 14400, 19200, or 38400 bps. If the modem is not operating in 
  495. error-control or ASB mode, this is the same as the line speed. See other 
  496. CONNECT messages and CARRIER messages.
  497.  
  498. 2 - RING
  499. This result code indicates the modem has detected a ring signal. No 
  500. distinction can be made as to whether this is a voice call, a modem 
  501. call, a fax call, or other type.
  502.  
  503. 3 - NO CARRIER
  504. This result code indicates that no carrier signal was detected, or that 
  505. the signal was lost. This is the response the modem will give when no 
  506. connection is made; see CONNECT result code. The modem will also return 
  507. this message when the connection is broken, either intentionally as when 
  508. the hangup process completes, or if line difficulties break the 
  509. connection.
  510.  
  511. 4 - ERROR
  512. This result code indicates that an invalid command was issued, or that 
  513. there was an error in the command line. For example, if the command line 
  514. exceeds the character limit for your modem, this result code will be 
  515. returned. See your user documentation to determine the character limit for 
  516. your modem. This result code is also returned in response to the I1 command 
  517. requesting a ROM checksum, if the modem detects an error in the computation.
  518.  
  519. 5 - CONNECT 1200
  520. This result code indicates a connection has been established at 1200, 
  521. 1200/75 or 75/1200 bps between the modem and the DTE. If the modem is 
  522. not operating in error-control mode, this is the same as the line speed. 
  523. This result code is disabled by X0. Only CONNECT is reported.
  524.  
  525. 6 - NO DIALTONE
  526. This result code indicates that no dial tone was detected when the modem 
  527. went off hook. Dial tone detection and this result code are enabled by 
  528. X2 or X4, or the W dial modifier.
  529.  
  530. 7 - BUSY
  531. This result code indicates that the modem detected a busy signal when it 
  532. attempted to connect with the modem at the number dialed. Busy signal 
  533. detection and this result code are enabled by X3 or X4.
  534.  
  535. 8 - NO ANSWER
  536. This result code indicates no silence was detected when dialing a system 
  537. not providing a dial tone. Enabled by the @ dial modifier.
  538.  
  539. 10 - CONNECT 2400
  540. This result code indicates a connection has been established at 2400 bps 
  541. between the modem and the DTE. If the modem is not operating in error-
  542. control mode, this is the same as the line speed. This result code is 
  543. disabled by X0. Only CONNECT is reported.
  544.  
  545. 11 - CONNECT 4800
  546. This result code indicates a connection has been established at 4800 bps 
  547. between the modem and the DTE. This result code is disabled by X0.
  548.  
  549. 12 - CONNECT 9600
  550. This result code indicates a connection has been established at 9600 bps 
  551. between the modem and the DTE. This result code is disabled by X0.
  552.  
  553. 13 - CONNECT 14400
  554. This result code indicates a connection has been established at 14400 
  555. bps between the modem and the DTE. This result code is disabled by X0.
  556.  
  557. 14 - CONNECT 19200
  558. This result code indicates a connection has been established at 19200 
  559. bps between the modem and the DTE. This result code is disabled by X0.
  560.  
  561. 22 - CONNECT 1200/75
  562. This result code indicates a connection has been established at 1200 bps 
  563. when transmitting data and 75 bps when receiving data between the modem 
  564. and the DTE.
  565.  
  566. 23 - CONNECT 75/1200
  567. This result code indicates a connection has been established at 75 bps 
  568. when transmitting data and 1200 bps when receiving data between the 
  569. modem and the DTE.
  570.  
  571. 24 - CONNECT 7200
  572. This result code indicates a connection has been established at 7200 bps 
  573. between the modem and the DTE. This result code is disabled by X0.
  574.  
  575. 25 - CONNECT 12000
  576. This result code indicates a connection has been established at 12000 
  577. bps between the modem and the DTE. This result code is disabled by X0.
  578.  
  579. 28 - CONNECT 38400
  580. This result code indicates a connection has been established at 38400 
  581. bps between the modem and the DTE. This result code is disabled by X0.
  582.  
  583. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  584. 1.2.2     Negotiation Progress Messages
  585.  
  586. Hayes products report special result codes during error-control 
  587. negotiation. Whether or not these messages are displayed is selected 
  588. with the W command (not to be confused with the W dial modifier). The 
  589. factory setting is messages disabled (W0) to avoid conflict with 
  590. software programs that do not support this additional level of call 
  591. progress monitoring.
  592.  
  593. Negotiation progress messages are reported in the following order:
  594.  
  595. CARRIER
  596. PROTOCOL
  597. AUTOSTREAM
  598. COMPRESSION
  599. CONNECT
  600.  
  601. If AutoStream is not used, no message is reported.
  602.  
  603. 40 - CARRIER 300
  604. This message indicates that a carrier signal has been detected at 300 
  605. bps (modem-to-modem line speed).
  606.  
  607. 44 - CARRIER 1200/75
  608. This message indicates that a carrier signal has been detected at 1200 
  609. bps when transmitting and at 75 when receiving (modem-to-modem line 
  610. speed).
  611.  
  612. 45 - CARRIER 75/1200
  613. This message indicates that a carrier signal has been detected at 75 bps 
  614. when transmitting and at 1200 bps when receiving (modem-to-modem line 
  615. speed).
  616.  
  617. 46 - CARRIER 1200
  618. This message indicates that a carrier signal has been detected at 1200 
  619. bps (modem-to-modem line speed).
  620.  
  621. 47 - CARRIER 2400
  622. This message indicates that a carrier signal has been detected at 2400 
  623. bps (modem-to-modem line speed).
  624.  
  625. 48 - CARRIER 4800
  626. This message indicates that a carrier signal has been detected at 4800 
  627. bps (modem-to-modem line speed).
  628.  
  629. 49 - CARRIER 7200
  630. This message indicates that a carrier signal has been detected at 7200 
  631. bps (modem-to-modem line speed).
  632.  
  633. 50 - CARRIER 9600
  634. This message indicates that a carrier signal has been detected at 9600 
  635. bps (modem-to-modem line speed).
  636.  
  637. 51 - CARRIER 12000
  638. This message indicates that a carrier signal has been detected at 12000 
  639. bps (modem-to-modem line speed).
  640.  
  641. 52 - CARRIER 14400
  642. This message indicates that a carrier signal has been detected at 14400 
  643. bps (modem-to-modem line speed).
  644.  
  645. 66 - COMPRESSION: CLASS 5
  646. This message indicates that data compression using MNP Class 5 has been 
  647. negotiated for the connection.
  648.  
  649. 67 - COMPRESSION: V.42BIS
  650. This message indicates that data compression using CCITT V.42bis has 
  651. been negotiated for the connection.
  652.  
  653. 68 - COMPRESSION: ADC
  654. This message indicates that data compression using Hayes Adaptive Data 
  655. Compression has been negotiated for the connection.
  656.  
  657. 69 - COMPRESSION: NONE
  658. This message indicates that data compression was not negotiated for the 
  659. connection.
  660.  
  661. 70 - PROTOCOL: NONE
  662. This message indicates that no protocol was negotiated for the 
  663. connection. A standard asynchronous connection was made.
  664.  
  665. 71 - PROTOCOL: ERROR-CONTROL/ LAPB
  666. This message indicates that an error-control connection was negotiated 
  667. with LAPB protocol. 
  668.  
  669. 72 - PROTOCOL: ERROR-CONTROL/ LAPB/HDX
  670. This message indicates that a half-duplex error-control connection was 
  671. negotiated with LAPB protocol. 
  672.  
  673. 73 - PROTOCOL: ERROR-CONTROL/LAPB/AFT
  674. This message indicates that an error-control connection was negotiated 
  675. using the Hayes Asynchronous Framing Technique. This protocol is used 
  676. for connections between modems such as Smartmodem 1200 that do not 
  677. communicate synchronously across the telephone line. AFT enables an 
  678. error-control protocol to be used.
  679.  
  680. 74 - PROTOCOL: X.25/LAPB
  681. This message indicates that an error-control connection using the X.25 
  682. protocol was established with a carrier speed of 1200, 2400, 4800, or 
  683. 9600 bps.
  684.  
  685. 75 - PROTOCOL: X.25/LAPB/HDX
  686. This message indicates that a half-duplex error-control connection using 
  687. the X.25 protocol was established with a carrier speed of 4800 or 9600 
  688. bps.
  689.  
  690. 76 - PROTOCOL: X.25/LAPB/AFT
  691. This message indicates that an asynchronous error-control connection 
  692. using the X.25 protocol was established with a carrier speed of 1200 
  693. bps. The Hayes Asynchronous Framing Technique was used.
  694.  
  695. 77 - PROTOCOL: LAP-M
  696. This message indicates that an error-control connection using the V.42 
  697. LAPM protocol was established. 
  698.  
  699. 78 - PROTOCOL: LAP-M/HDX
  700. This message indicates that a half-duplex error-control connection using 
  701. the V.42 LAPM protocol was established. 
  702.  
  703. 79 - PROTOCOL:  LAP-M/AFT
  704. This message indicates that an asynchronous error-control connection 
  705. using the V.42 LAPM protocol was established with a carrier speed of 
  706. 1200 bps. The Hayes Asynchronous Framing Technique was used.
  707.  
  708. 80 - PROTOCOL:  ALT
  709. This message indicates that an errorge indicates that an error-control 
  710. connection using the V.42 LAPM alternative protocol was established.  
  711. This protocol is MNP Classes 2, 3, and 4 compatible.
  712.  
  713. 91 - AUTOSTREAM:        LEVEL 1
  714. This message indicates that Hayes AutoStream Level 1 has been negotiated 
  715. for the connection. This technique provides for multiplexing of multiple 
  716. virtual channels.
  717.  
  718. 92 - AUTOSTREAM:        LEVEL 2
  719. This message indicates that Hayes AutoStream Level 2 has been negotiated 
  720. for the connectionsage indicates that Hayes AutoStream Level 2 has been 
  721. negotiated for the connection. This technique provides for multiplexing 
  722. of multiple virtual channels, with transparent control of one PAD (non-
  723. simultaneous). Level 3 has been negotiated for the connection. This 
  724. technique provides for multiplexing of multiple virtual channels, with 
  725. transparent control of all PADs (simultaneous).
  726.  
  727. 93 - AUTOSREAM          LEVEL 3
  728. This message indicates that Hayes Autostream Level 3 has been negoitiated 
  729. for the connection. This technique provides for multiplexing of multiple 
  730. virtual channels, with transparent control of all PADs (simultaneous). 
  731.  
  732. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  733.  
  734. S95     Negotiation Message Options
  735.  
  736. S95 enables various result codes that indicate the sequence of events in 
  737. the establishment of an error-control connection. This register does not 
  738. affect the way in which the modem negotiates the connection; it merely 
  739. enables message options. The factory setting for this register is value 
  740. 0, no bits selected. To enable any combination of the bits, add the 
  741. value(s) to the right of the bit number and set the register to this 
  742. sum.
  743.  
  744. Note: The bit values of S95 may be set to override some of the 
  745. characteristics of the Wn command. Setting any of the S95 bits to "1" 
  746. enables the corresponding result codes regardless of the Wn command in 
  747. effect. Changing the Wn command setting does not affect the value set 
  748. for this register.
  749.  
  750. Bit   Value    Explanation
  751. ------------------------------------------------------------------------
  752. 0     1        Verbose CONNECT result code indicates the DCE speed 
  753.                (rather than DTE speed). Numeric result codes are also 
  754.                different when CONNECT reports DCE speed.
  755. 1     2        Append "/ARQ" to CONNECT result code when an 
  756.                error-control connection is made.
  757. 2     4        Add CARRIER messages
  758. 3     8        Add PROTOCOL messages
  759. 4     16       Add AUTOSTREAM messages
  760. 5     32       Add COMPRESSION messages
  761. ------------------------------------------------------------------------
  762.  
  763. For example, if you want to add the compression result code (with W1 
  764. selected), you would select bit 5 (value of 32). The command line 
  765. ATS95=32J<CR> will then enable the COMPRESSION negotiation messages.
  766.  
  767. Refer to the Wn and Xn commands for additional and related information. 
  768.  
  769.  
  770. ========================================================================
  771. APPENDIX D:  APPLICATION SUGGESTIONS
  772.  
  773. This appendix offers suggestions for developing applications software 
  774. using the Hayes Standard AT Command Set. The techniques described apply 
  775. to Hayes modems in general except where specifically indicated. Although 
  776. provided here, this information is intended for experienced programmers 
  777. who want assistance in modem application development.
  778.  
  779. ************************************************************************
  780. D.1  Modem Identification
  781.  
  782. The initial concern for most communications software is modem 
  783. identification. Before the software determines the type of modem (e.g., 
  784. is it a Hayes modem, a high-speed modem, what features does it support -
  785. error-control or compression?). By limiting the AT command controller 
  786. portion of the software to work with a known set of modems, you can 
  787. limit the complexity of your software.
  788.  
  789. Because the type of modem that will be present, certain assumptions can 
  790. be made regarding modem characteristics, such as maximum transmission 
  791. rate, support of AT commands or specific commands such as L or 
  792. X. If a more general application is being designed for an environment 
  793. about which assumptions cannot be made regarding type or brand of modem 
  794. that might be used, the software's first task should be to identify the 
  795. modem.
  796.  
  797. The I0 and I4 command options make this process simple. In the initial 
  798. versions of Smartmodem 1200, I0 returned the three digit response: 120. 
  799. Since then, responses have been extended for several groups identifying 
  800. modem supporting 2400 bps, 9600 bps, and other products. The I0 response 
  801. simply indicates the speed category of the modem.
  802.  
  803. The result of the I0 command is a number which identifies the category 
  804. of modem product. Some unique I0 values can be used to identify a unique 
  805. product which has specific behaviors. 960, for example, identifies a 
  806. Hayes product capable of 9600 bps, which has additional commands and 
  807. behaviors.
  808.  
  809. The I4 command provides a reliable means of communicating 
  810. specific features and modulation protocols to software. The responses to 
  811. the I4 command are strings delimited by <CR> and beginning with a 
  812. lowercase letter and typically followed by a hex-character bit-map. The 
  813. I0 and I4 responses currently defined are detailed in the description of 
  814. the I4 command in Chapter 1.  The tables show the decoding of the hex-
  815. map returned in the "a", and "b" bit-mapped strings. If I4 is used to 
  816. identify features of the modem, consider that new result strings are 
  817. periodically defined that may be returned in addition to those expected. 
  818. Fields once designated as "reserved" that held a zero may now have values 
  819. assigned. The strings themselves may also be of different lengths than 
  820. previously implemented.
  821.  
  822. In spite of the modifications to this command necessary to be current 
  823. with new modems, the I4 command is the best way for software to 
  824. determine the modem type and capability, if the guidelines below are 
  825. considered:
  826.  
  827. *  I0 or I4 commands should be issued at 1200 bps. All Hayes products 
  828. (including the Smartmodem 300) respond to AT commands at 1200 bps. Most 
  829. other brands also respond at 1200 bps. You can switch to a higher 
  830. transmission rate once the modem has been identified.
  831.  
  832. *  Result codes should be parsed as strings surrounded by <CR><LF>. The 
  833. string will begin with a lower-case letter followed by up to 39 
  834. additional characters.
  835.  
  836. *  After all result strings have been sent, an OK result is returned 
  837. that obeys the V and Q command settings.
  838.  
  839. *  ERROR, OK, or a numeric result in response to the I4 command should 
  840. be expected. These results may be returned by products shipped before 
  841. the I4 command was introduced, or by non-Hayes products.
  842.  
  843. *  The length of the strings may be different than anticipated. If 
  844. shorter than expected, empty positions should be presumed zeros. If 
  845. longer than expected, extra characters should be ignored.
  846.  
  847. *  Some non-Hayes brand modems return unpredictable results in response 
  848. to I0 or I4 commands. One brand of modem actually responds with its 
  849. configuration when the I4 command is sent.
  850.  
  851. An example I4 command and response is shown below:
  852.  
  853.                      AT E0 V1 Q0 S0=0 I4 <CR>
  854. response:
  855.  
  856.      <CR><LF>a087840C004424<CR><LF> 
  857.      <CR><LF>bF60410000<CR><LF> 
  858.      <CR><LF>cUS<CR><LF> J
  859.      <CR><LF>m0000000001001FFFF<CR><LF> 
  860.      <CR><LF>OK<CR><LF> 
  861.  
  862. Note: Each I4 result is surrounded by <CR><LF>; not all responses are 
  863. hex-strings; and some responses may not be expected at all.
  864.  
  865. ************************************************************************
  866. D.2  Result Code Recognition
  867.  
  868. Modems that are equivalent to Hayes modems support verbose and numeric 
  869. forms of result codes. Unless echo may be a problem and you will be 
  870. installing the controller in a limited-growth environment, verbose 
  871. results rather than numeric results are preferred. Numeric result codes 
  872. were originally intended to make it easier for software to control the 
  873. modem, but there are two primary reasons they should not be used:
  874.  
  875. Software can be confused by a command echo. For example, if the 
  876. following command were sent with echo on (E1) and numeric results (V0) 
  877. on:
  878.  
  879.                        AT ... S9=20 <CR>
  880.  
  881. The resulting data, echoed by the modem, would be followed by the 
  882. numeric result code zero, meaning OK:
  883.  
  884.                       AT ... S9=20<CR>0 <CR>
  885.  
  886. Software may become confused by seeing a 0<CR> result which is actually 
  887. part of the command echo, then another 0<CR> which is the numeric 
  888. result. A program can become unsynchronized with the command processor 
  889. in the modem.
  890.  
  891. Turning off echo mode (E0) in the initial setup string would solve this 
  892. problem; however, do not end that command with any digits (simply E).
  893.  
  894. Another shortcoming of numeric results is that the software must 
  895. anticipate all possible responses. This requires updating controller 
  896. software whenever new result codes are added. For example, suppose a 
  897. CONNECT 115200 result were added with a numeric value of 31. If verbose 
  898. results were used instead, and the controller directed to interpret the 
  899. number after the CONNECT result as simply the connection speed in bits 
  900. per second, no changes to the driver are necessitated by the new result 
  901. code. If, however, numeric result codes were used, the result code 31 
  902. must be added to the table, and the controller modified to interpret it 
  903. appropriately.
  904.  
  905. As characters are received, they should be processed through a state 
  906. machine providing the functionality of the following one. This state 
  907. machine recognizes strings surrounded by <CR><LF> characters and stores 
  908. the string in a character array. <CR><LF> are defined by S3 and S4.
  909.  
  910. Sample State Machine
  911. Initialize with: state = 1 ;
  912.  
  913. ch = <next character from the input>
  914. switch( state )
  915. {
  916.      case 1:     /*-- Scanning for leading CR --*/
  917.                if( ch == CR ) state = 2 ;
  918.                i = 0 ;
  919.                break ;
  920.      case 2:     /*-- Scanning for leading LF --*/
  921.                if( ch == LF ) state = 3 ;
  922.                else if( ch == CR ) state = 2 ;
  923.                else state = 1 ;
  924.                break ;
  925.      case 3:     /*-- Buffer result, watch for trailing CR --*/
  926.                if( ch == CR ) state = 4 ;
  927.                else buf[ i++ ] = ch ;
  928.                if( i > LIMIT ) state = 1 ;
  929.                break ;
  930.      case 4:     /*-- Scanning for trailing LF --*/
  931.                if( ch == LF ) state = 5 ;
  932.                else if( ch == CR ) state = 2 ;
  933.                else state = 1 ;
  934.                break ;
  935. }
  936. if( state == 5 )
  937. {
  938.      buf[ i ] = 0 ; /* Null terminate buffer */
  939.      <process result in 'buf'>
  940.      state = 1 ;
  941. }
  942.  
  943. This state machine can be imbedded within a loop that reads all received 
  944. data one character at a time, checks for a timeout, and also checks for 
  945. user abort. Once a result is recognized, that loop can be exited or 
  946. continued if additional results are expected.
  947.  
  948. Once a result code string is returned, it can be compared against the 
  949. known result code strings. Some strings may incorporate wild-card 
  950. suffixes. For example CONNECT followed by any numeric value indicates a 
  951. successful connection at the indicated transmission rate. Even if a 
  952. result such as CONNECT 38400 is not anticipated, if the controller has 
  953. been coded for wild-card recognition, the controller will be capable of 
  954. interpreting such responses correctly. This practice also facilitates 
  955. interpretation of connection failed messages that are preceded by NO 
  956. followed by any other character string such as DIALTONE, CARRIER, or 
  957. ANSWER.
  958.  
  959. ************************************************************************
  960. D.3  Modem Preparation
  961.  
  962. Once the modem has been identified, the controller can continue to 
  963. program any registers or user-defined values into the modem necessary 
  964. prior to initiating the connection process. Typically, the setup 
  965. operation is separated from the connection processing because it is 
  966. performed independently of whether the call establishment will be in the 
  967. originating or answering mode.
  968.  
  969. Setup commands can be issued at the highest transmission rate the modem 
  970. supports as determined from the identification process or it may be 
  971. fixed at a certain value if the modem is not identified.
  972.  
  973. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  974. D.3.1  Reset
  975.  
  976. Before issuing any other commands to the modem, it is advisable to issue 
  977. a Z or &F command to the modem before the identification or setup 
  978. process. No specific response should be anticipated. The modem may be 
  979. set up to return numeric, or no result codes. If a reset will be used, 
  980. the following points should be considered:
  981.  
  982. *  Even if a recognizable result within 2.6 seconds, the program should 
  983. continue. (Some modems do a lengthy reset process before responding with 
  984. a result; others may be in Q1 or V0 mode.)
  985.  
  986. *  Following an OK result, an additional 600ms delay should be imposed. 
  987. Some modems will respond with an OK then do lengthy reset processing, in 
  988. which case they are unable to accept additional commands.
  989.  
  990. After the modem is reset, the first setup string (e.g., verbose rather 
  991. than numeric result codes) should be issued, then the identification 
  992. command.
  993.  
  994. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  995. D.3.2  Setup
  996.  
  997. Software should generally provide some modem setup. However, the 
  998. software can be written to rely on modem configuration via a stored 
  999. profile recalled on reset, or  by DIP switches set depending on the 
  1000. product. In this case, any unique settings must have been set up prior 
  1001. to running the software, and all the program does is send the Z command 
  1002. to recall the desired profile. Even more basically, software can assume 
  1003. the modem is in the power-up state. However, unless the software will be 
  1004. used within a very predictable environment, these assumptions may result 
  1005. in failures with the controller software.
  1006.  
  1007. Some commands will always be overridden by the controller in order to 
  1008. ensure its proper functioning. Other command options should either 
  1009. default to the factory setting, or simply act as the "transfer agent" 
  1010. for the commands specified by the user. Menus and dialogs can be 
  1011. provided to prompt the user for specific activities; the program can 
  1012. then interpret these requests and configure the modem accordingly, as 
  1013. Hayes Smartcom products do, or provide the user opportunity to enter AT 
  1014. command strings.
  1015.  
  1016. Commands frequently set by a modem controller:
  1017.  
  1018. E0         Turn off echo mode to avoid having command echoes pass 
  1019.            through the result code scanner.
  1020.  
  1021. &F         Recall the factory profile.
  1022.  
  1023. Q1         Enable result codes to ensure that commands are being 
  1024.            processed, and to synchronize with the modem command 
  1025.            processor (except for synchronous communications where result 
  1026.            codes may cause the DTE confusion).
  1027.  
  1028. V0 or V1   Use either numeric result codes or verbose (recommended) 
  1029.            result codes.
  1030.  
  1031. S0=0       Disable auto-answer during the setup process to avoid 
  1032.            inadvertent disruption by an incoming call.
  1033.  
  1034. H0         Ensure modem is on hook before continuing to the answer or 
  1035.            originate process.
  1036.  
  1037. S12=10     Set the escape sequence guard time to 200ms to hasten the 
  1038.            escape for hang-up process. Also reduces the probability of 
  1039.            inadvertent user escapes.
  1040.  
  1041. S2=*       Change the escape sequence character for two reasons: To 
  1042.            avoid inadvertent user escapes, and to provide different 
  1043.            escape sequence characters for answer and originate ends. 
  1044.            This prevents inadvertent escaping when data is echoed.
  1045.  
  1046. S4=*       Modify the linefeed character to make the <CR><LF>NO 
  1047.            CARRIER<CR><LF> result code more unique if you scan for it
  1048.            to detect carrier loss.
  1049.  
  1050. S95=60     Enables the result codes which will provide the maximum 
  1051.            amount of information about the connection when it is 
  1052.            established.
  1053.  
  1054. Two typical setup sequences using these recommendations are shown below:
  1055.  
  1056. Recommendation for software design based on using pre-existing user 
  1057. settings:
  1058.               AT E Q V S0=0 H S12=10 S2=28 S4=31 S95=60 <CR>
  1059.  
  1060. Recommendation for software design based on starting from a known 
  1061. factory setting: 
  1062.               AT &F S2=28 S4=31 S12=10 S95=60
  1063.  
  1064. Note: Where the zero suffix is used, it may be omitted from a command. 
  1065. Spaces are shown above for readability, but the use of spaces between 
  1066. commands is not recommended. 
  1067.  
  1068. Once this setup command has been sent, and the OK response returned, the 
  1069. controller can continue to the originate or answer processing.
  1070.  
  1071. If user-programmed settings are included in additional setup strings, or 
  1072. the user is permitted to enter AT setup strings, the software should 
  1073. anticipate ERROR result codes. If an ERROR is returned in response to 
  1074. such a command, the result does not have to be reported to the user, but 
  1075. the controller should not be prevented from continuing in either case. 
  1076. Many times a connection can be made even though some setting is in error 
  1077. or is inappropriate for the class of modem being addressed.
  1078.  
  1079. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1080. D.3.3  Establishing the Desired Connection and Fallback Strategy 
  1081.        (S36 Developers' Tips)
  1082.  
  1083. S36 determines which fallback action will occur if the protocols and 
  1084. procedures set by S46 and S48 do not produce a LAP-based (LAPB) error-
  1085. controlled connection.
  1086.  
  1087. The optimum fallback control strategy depends on which Hayes error-
  1088. control modem you have. The fallback behavior is determined by S36, S46, 
  1089. S48, and &Q5.
  1090.  
  1091. There have been two improvements in the V-series, OPTIMA and ACCURA EC 
  1092. modems that affect S36: The first added &Q6 Asynchronous Speed Buffering
  1093. (ASB); ASB provides the same fixed speed DTE interface and local flow control 
  1094. as in the error control mode but without the error control or remote 
  1095. flow control. The second improvement added V.42 with its Alternate 
  1096. Protocol (MNP).
  1097.  
  1098. Previously, S36 only consisted of one bit, Bit 0, 
  1099. which permitted the user to decide whether the modem would hang up or 
  1100. not if it did not succeed in negotiating an error-controlled connection. 
  1101. The factory default for S36 was 1, which meant fall back to direct async 
  1102. rather than hang up if an error control protocol is not established in 
  1103. &Q5 mode.
  1104.  
  1105. When &Q6 (ASB) was added, a fall back option for &Q5 mode, which can be 
  1106. controlled with S36, was also added. If S36 Bit 1 is set, and bit 0 is 
  1107. also set, the modem will fall back to ASB instead of direct async if no 
  1108. error control protocol is established in &Q5 mode. The factory default 
  1109. for S36 remained 1.
  1110.  
  1111. When V.42 was added, it added another fall back option, MNP, to S36. If 
  1112. S36 Bit 2 is set, then MNP will be attempted if the primary protocol 
  1113. selected in S48 is not established. Bit 2 is evaluated before Bits 0, 
  1114. then Bit 1. If MNP is established as the protocol, then Bits 0 and 1 are 
  1115. ignored. The factory default became 5 and later was changed to 7 to take 
  1116. more advantage of ASB.
  1117.  
  1118. Now that we know that there are three versions of S36, we may need a way 
  1119. to tell which version our software is controlling. First, verify that it 
  1120. is a Hayes error-control modem. This is done by issuing an I4 command 
  1121. and looking for the existence of a "b-string". A b-string begins with a 
  1122. lower case letter "b" and is followed by several upper case letters or 
  1123. numbers forming a hex value.
  1124.  
  1125. The easiest way for software to identify whether a Hayes modem 
  1126. supports Asynchronous Speed Buffering (also known as ASB, Buffered 
  1127. Async, or Normal) is to issue the following AT command,  AT &Q6 &Q5 
  1128. <CR>. If the result code is OK then &Q6 is supported, and ASB is also 
  1129. supported as a fall back. If the result code is ERROR, then &Q6 is not 
  1130. supported. If this is the case, then software should be prepared to fall 
  1131. back to a direct async connection.
  1132.  
  1133. The easiest way for software to identify whether a Hayes modem 
  1134. supports V.42 (and MNP) is to decode the first character after the 
  1135. leading "b" in the b-string of the I4 ID command response. The 
  1136. characters following the "b" in that line are "ASCII-hex" (0-9, A-F), 
  1137. which decode into 4 bits of ID code (3-0).  If Bit 3 is set, then MNP is 
  1138. supported; Bit 2 is V.42.
  1139.  
  1140. Armed with the knowledge of which S36 bits are supported, the software 
  1141. may now safely configure the modem and properly anticipate the fall-back 
  1142. action.
  1143.  
  1144. It should be safe to set S36 bit 2 to enable V.42 (and MNP) even if 
  1145. those protocols are not supported in the modem.
  1146.  
  1147. If the modem does not support ASB, then software should be prepared to 
  1148. follow the CONNECT XXXXX speed result code and change the DTE port speed 
  1149. to match the indicated line speed of the direct connection when no error 
  1150. controlled connection was negotiated.
  1151.  
  1152. If software will not change port speeds in response to the CONNECT 
  1153. message, then when software has identified a 'pre-ASB' modem, 
  1154. it should set S36 to 0 or 4 so that if no protocol is negotiated, the 
  1155. modem will hang up.
  1156.  
  1157. The following table shows the order in which the bits of S36 are 
  1158. evaluated: (Remember, these steps only occur after the S46/S48 
  1159. selections have failed to make a LAPBased error controlled connection in 
  1160. &Q5 mode.)
  1161.  
  1162. ------------------------------------------------------------------------
  1163. S36      Bit 7-3=0       reserved 
  1164. First    Bit 2 (4)       If set, means try MNP protocol; reset means 
  1165.                          don't use MNP. 
  1166. Third    Bit 1 (2)       If set, means fall back to ASB; reset means 
  1167.                          direct async. 
  1168. Second   Bit 0 (1)       If set, means fall back based on Bit 1;
  1169.                          reset means hang up.
  1170. ------------------------------------------------------------------------
  1171.          
  1172. The following table shows the meaning of each setting:
  1173.  
  1174. ------------------------------------------------------------------------
  1175. S36=7   Try MNP, then fall back to ASB. 
  1176. S36=6   Try MNP, then hang up. 
  1177. S36=5   Try MNP, then fall back to direct async. 
  1178. S36=4   Try MNP, then hang up. 
  1179. S36=3   Don't try MNP; fall back to ASB. 
  1180. S36=2   Don't try MNP; hang up. 
  1181. S36=1   Don't try MNP; fall back to direct async. 
  1182. S36=0   Don't try MNP; hang up.
  1183. ------------------------------------------------------------------------
  1184.  
  1185. There are three types of fallback stratagies which Hayes products use.
  1186.  
  1187. Type 1: Hayes Modem Operation in &Q5 Communications Mode
  1188. Applies to V-series Smartmodem 2400 up to and including Version 1.3 and 
  1189. V-series Smartmodem 9600 up to and including Version 1.4.
  1190.  
  1191. Type 2: Hayes Modem Operation in &Q5 Communications Mode
  1192. Applies to V-series Smartmodem 2400 Version 1.4 and V-series Smartmodem 
  1193. 9600 Versions 1.5 and 1.6.
  1194.  
  1195. Type 3: Hayes Modem Operation in &Q5 Communications Mode
  1196. Applies to all V-series products newer than Types 1 and 2 and all OPTIMA 
  1197. and ACCURA EC products.
  1198.  
  1199. ------------------------------------------------------------------------
  1200.                ATI3 Response contains...     
  1201.                V-SERIES SMARTMODEM 2400    V-SERIES SMARTMODEM 9600
  1202. Type 1         04-00005-10                 04-00015-10
  1203.                04-00005-11                 04-00015-11
  1204.                04-00005-12                 04-00015-12
  1205.                04-00005-13                 04-00015-13
  1206.                                            04-00015-14
  1207. Type 2         04-00005-14                 04-00015-15
  1208.                                            04-00015-16
  1209. Type 3         Does not contain any        Does not contain any
  1210.                of the above numbers        any of the above numbers
  1211. ------------------------------------------------------------------------
  1212.  
  1213. ************************************************************************
  1214. D.4  Connect Processing
  1215.  
  1216. Once the setup operation has been completed, the commands to establish 
  1217. the connection can be issued. The instruction can be either to originate 
  1218. (using the D command), or to answer (using the A or S0 commands).
  1219.  
  1220. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1221. D.4.1  Originating a Call
  1222.  
  1223. If the D command is issued with the desired phone number, several 
  1224. possible result codes can be returned. The list below outlines some 
  1225. results to expect:
  1226.  
  1227. Result Code        Meaning
  1228. ------------------------------------------------------------------------
  1229. NO CARRIER         Connection failed
  1230. NO ANSWER          No response to '@' dial modifier
  1231. NO DIALTONE        No dial tone in X4 mode
  1232. NO ____            Connection failed for some other reason
  1233. BUSY               Busy signal detected
  1234. CONNECT ____       Connection successful; you may need to change DTE 
  1235.                    speed to the indicated baud rate. (See Wn and S95)
  1236. CARRIER ____       * DCE carrier speed. (See Wn and S95)
  1237. PROTOCOL: ____     * Error-correction protocol being used by the modems. 
  1238.                    (See Wn and S95)
  1239. COMPRESSION:____   Compression technique in use by modems. (See Wn 
  1240.                    and S95)
  1241. AUTOSTREAM         Autostream technique in use by modems if selected by 
  1242.                    user. (See Wn and S95)
  1243. ------------------------------------------------------------------------
  1244.  
  1245. Ignore other responses, but continue to wait for CONNECT ___, BUSY, or 
  1246. NO ___ responses. The CARRIER and PROTOCOL results are intermediate 
  1247. results and precede either a CONNECT ____ or NO ____ result. These 
  1248. results are only returned by Hayes modems when configured to use an 
  1249. error-correcting protocol.
  1250.  
  1251. If you recognize any numeric value for the baud rate after the CONNECT 
  1252. result, you will have a much more robust controller able to handle many 
  1253. situations. You can use the PROTOCOL result to determine if the flow 
  1254. control requested by the &K command is in effect.
  1255.  
  1256. Note: If you want to manually dial a call and then have the modem connect, 
  1257. enter the command string ATX1D (X1 disables dial tone detection) when you 
  1258. hear the dial tone. 
  1259.  
  1260. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1261. D.4.2  Answering a Call
  1262.  
  1263. The simplest technique for answering an incoming call is to set S0 and 
  1264. wait for a CONNECT ___ result. You may get several RING results, and 
  1265. possibly a NO CARRIER result if the caller hangs up before connecting. 
  1266. These results should not cause your controller to abort. Continue to 
  1267. wait for a CONNECT result code.
  1268.  
  1269. If you set S0, you may want to set it back to zero after your controller 
  1270. finishes the call to prevent inadvertent answering when your software is 
  1271. not running. By setting S0 to the number of rings you desire before the 
  1272. modem answers, you utilize the ring detection technology already built 
  1273. into the modem.
  1274.  
  1275. You should not use the A command to answer after counting RING results 
  1276. because the command may collide with another RING result from the modem 
  1277. and be missed. The RING results may be generated in pairs depending on 
  1278. the ringing cadence of the phone system.
  1279.  
  1280. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1281. D.4.3  Using the CD Line
  1282.  
  1283. Monitoring the Carrier Detect (CD) line of the RS-232 interface is 
  1284. another technique for carrier detection in answer or originate mode. 
  1285. This assumes that &C1 or the corresponding DIP-switch has been set and 
  1286. the cable is wired properly. Both are risky assumptions. You will have a 
  1287. more robust controller if you use result code scanning rather than the 
  1288. RS-232 lines.
  1289.  
  1290. If you use CD, you do not know when the modem has given up waiting for 
  1291. the carrier, or why. If the line is busy, you may want to re-try the 
  1292. dial operation. If there is no dial tone, the user needs to know this.
  1293.  
  1294. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1295. D.4.4  Aborting a Connect Request
  1296.  
  1297. Once the D or S0 command has been issued, the modem goes off hook (or 
  1298. may be off hook for S0) and it must be put back on hook (hangPup) before 
  1299. the abort is completed. To abort an in-progress connect command, send 
  1300. any character to the modem. This will typically result in a NO CARRIER 
  1301. response. The result code scanner should be called after the abort 
  1302. character is sent to prevent additional commands from being sent before 
  1303. the controller and the modem are again in sync.
  1304.  
  1305. Smartcom products send AT<CR> to abort an in-progress connect command. 
  1306. This elicits a result code regardless of whether the modem were off-hook 
  1307. or not. If the modem was off-hook attempting to connect, this will abort 
  1308. the connect operation and return NO CARRIER. If the modem was on-hook in 
  1309. command mode, this simply returns <CR><LF>OK<CR><LF>.
  1310.  
  1311. ************************************************************************
  1312. D.5  Carrier Loss Detection
  1313.  
  1314. You want your application to be able to detect when the carrier has been 
  1315. lost so you can determine when the connection is complete. You might be 
  1316. unable to put this part of the code in your controller software, since 
  1317. the controller is typically running only during the connect or hang-up 
  1318. process. Once the application has detected the carrier loss event, it 
  1319. can call the modem controller and restore the modem settings.
  1320.  
  1321. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1322. D.5.1  Using the CD line
  1323.  
  1324. If you are confident of the communications environment and cabling 
  1325. requirements, and have access to the RS-232 signal status, then 
  1326. monitoring the CD line is the easiest carrier loss detection method to 
  1327. implement. This requires &C1 to be programmed at setup time, or be 
  1328. stored in the modem as the value recalled on reset or power-up.
  1329.  
  1330. However, this is the most restrictive and risky choice. It requires a 
  1331. properly wired cable and support of &C1 by the modem's command set or 
  1332. proper DIP-switch settings.
  1333.  
  1334. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1335. D.5.2  Scanning the Incoming Data Stream
  1336.  
  1337. In cases where you  cannot depend on 100% Hayes compatibility or want to 
  1338. be independent from the cable wiring, then scanning for the NO CARRIER 
  1339. result code is more reliable. It is also more complex to implement.
  1340.  
  1341. Typically, at the low-level of the program all received data is 
  1342. retrieved through one subroutine. This subroutine can be augmented or 
  1343. layered to provide the service needed. As data passes through, the last 
  1344. fourteen characters are buffered, typically in a circular buffer. If 
  1345. more data passes in each call, only the last fourteen need to be copied. 
  1346. At a time when the processor is free, such as after 100 ms of idle time 
  1347. or the receive routine has returned no data for 30 to 100 calls, then 
  1348. the buffer is compared against the <CR><LF>NO CARRIER<CR><LF> result 
  1349. code. If a match is found, the carrier lost event is triggered.
  1350.  
  1351. By only checking when there is idle time, or after no data has been 
  1352. received for a while, you reduce the CPU overhead and ensure that the 
  1353. modem is not falsely triggered when the string is imbedded in an actual 
  1354. data stream.
  1355.  
  1356. You can also modify the linefeed character by using S4 to a different 
  1357. value such as S4=31 to make the result code sequence more unique. This 
  1358. action, however, affects other result codes generated by the modem.
  1359.  
  1360. ************************************************************************
  1361. D.6  Escape and Hang Up
  1362.  
  1363. When your controller has been instructed to terminate the connection, 
  1364. you must put the modem back in command state and issue the hang-up (H) 
  1365. command. In addition to hanging-up, you will also want to restore 
  1366. settings you changed to their factory-set values, or issue an ATZ<CR> to 
  1367. undo the effects of your changes. In any case, restoration of the modem 
  1368. settings is necessary even if the connection was terminated due to loss 
  1369. of carrier.
  1370.  
  1371. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1372. D.6.1  Escaping the Modem to Command State
  1373.  
  1374. To escape the modem, the controller must first delay the escape sequence 
  1375. guard time (specified by S12), then issue the escape sequence character 
  1376. three times (specified by S2); then wait for an OK result. Waiting for 
  1377. the result also enforces the required guard time after the escape 
  1378. sequence. Once the OK result is received, the modem has entered command 
  1379. state. The controller can then hang up and restore the modem.
  1380.  
  1381. The controller software must be sure to wait the required guard time 
  1382. before sending the escape sequence characters. Your controller may have 
  1383. been called just after data was transmitted and, without the delay, your 
  1384. characters will just be sent without triggering the escape sequence 
  1385. recognition process. It is important that the serial transmitter be 
  1386. permitted to be idle for the escape sequence guard time, plus a few 
  1387. extra milliseconds to allow for error, before sending characters.
  1388.  
  1389. For example, if  S12=10, a delay of at least 200 milliseconds is 
  1390. required before sending the escape sequence characters. After sending 
  1391. the escape sequence characters, the OK result will be received after 
  1392. another 200 millisecond wait. This completes the escape sequence process 
  1393. in slightly over 400 milliseconds. If S12=50 (factory setting) is used, 
  1394. one full second must pass before the characters can be sent, then 
  1395. another second delay must transpire prior to the OK result. This 
  1396. completes the process in slightly over two seconds. For this reason, it 
  1397. is recommended that S12=10 be issued to speed up this process.
  1398.  
  1399. A delay slightly longer than that stored in S12 should be used to allow 
  1400. for errors in the system clock as well as in the modem clock. 100ms is 
  1401. an adequate safety margin.
  1402.  
  1403. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1404. D.6.2  Using DTR to Escape or Hang Up
  1405.  
  1406. The DTR RS-232 signal can be used to escape the modem to command state, 
  1407. or to reset the modem depending on the &D command set or DIP-switch 
  1408. settings. This also requires the cable to be properly wired. Unless the 
  1409. software will operate in a highly-controlled environment, this technique 
  1410. is discouraged over using the escape sequence process because of the 
  1411. requirements to make it function properly. Leaving a call connected 
  1412. simply because the cable was not properly wired can be potentially 
  1413. expensive. The escape sequence is reliable in all environments if it is 
  1414. properly utilized.
  1415.  
  1416. ************************************************************************
  1417. D.7  Modem Re-configuration
  1418.  
  1419. When a call has been completed, a "clean-up" command should be issued to 
  1420. return the modem a more known configuration. For example, if verbose 
  1421. result codes were selected when the modem was reset, and the controller 
  1422. selected numeric result codes, on completing the session, the controller 
  1423. should reset the modem to re-select verbose result codes. In the same 
  1424. way, if the linefeed character were changed to suit the software or 
  1425. environment, the character should be set to its former value. Any other 
  1426. command options that were modified, should be restored to their factory-
  1427. set values.
  1428.  
  1429. The minimum the controller should do when through with the modem is 
  1430. issue a Z command option to ensure the modem is restored to its power-up 
  1431. state.
  1432.  
  1433. ************************************************************************
  1434. D.8  Timing Considerations
  1435.  
  1436. A modem controller inherently has a sense of time. Usually all that is 
  1437. needed to utilize the timing part of the controller is access to a time 
  1438. reference. For example, the number of milliseconds since power-up or 
  1439. program launch, or a "system tick" value can be used. 
  1440.  
  1441. Under DOS, the INT 1C timer tick produces an interrupt every 55 
  1442. milliseconds. An ISR can be installed on this interrupt to add 55 to a 
  1443. long integer every time it is called. This will provide a millisecond 
  1444. counter.
  1445.  
  1446. On the Macintosh, the "Tick Count" function will return the number of 
  1447. vertical-retrace ticks since computer power-up. Each tick represents 
  1448. 1/60 of a second.
  1449.  
  1450. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1451. D.8.1  Programming for Time
  1452.  
  1453. The time value is used to determine relative time. For example, if a 
  1454. loop should be executed for only 2 seconds it could be coded as:
  1455.  
  1456. timeout = Tick Count( ) + 120 ; /* 60 tics per second = 2 seconds */
  1457. do
  1458. {
  1459.      got_one = Check_Result( ) ;
  1460. }
  1461. while( ( ! got_one ) && ( SystemTick( ) < timeout ) ) ;
  1462.  
  1463. This code fragment continues to call the Check_Result function until it 
  1464. returns a true value, or until two seconds have elapsed.
  1465.  
  1466. This technique is independent of processor speed. A faster processor may 
  1467. make thousands of trips through the loop, where a slower one would only 
  1468. make a few hundred. Any anticipated result code would arrive within that 
  1469. two-second real-time window.
  1470.  
  1471. Care should be given to considering when to start the timing loop. If an 
  1472. AT command string is sent, then a loop executed, the time interval may 
  1473. also include the time required to send the AT command (if data is 
  1474. buffered and sent by an interrupt service routine).
  1475.  
  1476. At 300 bps, where each character takes 33ms just to transmit (10/300), a 
  1477. 40 character AT command would take over a second to transmit. This means 
  1478. a two second loop spends more than half of its time waiting for the AT 
  1479. command process to complete, leaving only a fraction of a second for the 
  1480. modem to respond with the result (again at 33ms per character).
  1481.  
  1482. One way to avoid this is to wait until all data has been transmitted by 
  1483. an ISR before entering the result code scan loop. Alternatively, more 
  1484. time can be provided for loops to process results. Another option is to 
  1485. measure idle time rather then elapsed time.
  1486.  
  1487. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1488. D.8.2  When to Consider Time
  1489.  
  1490. The use of timing varies from command to command and operation to 
  1491. operation. Some commands take longer to execute. The guidelines below 
  1492. can be used to determine the best amount of time to wait.
  1493.  
  1494. *  For the Z command, wait two seconds for a response, then wait an 
  1495. additional 600 ms, whether a response were received or not.
  1496.  
  1497. *  For general setup commands, wait two seconds for the response.
  1498.  
  1499. *  For the hang-up command (H), wait up to 20 seconds for a response. 
  1500. Some modems may take longer to hang-up if data buffered within the 
  1501. modem is still waiting to be transmitted and acknowledged. This time is 
  1502. controlled by S38.
  1503.  
  1504. *  For dial commands (D or O) wait at least one minute or more. Values 
  1505. set for carrier detect time, tone versus pulse dialing, commas in the 
  1506. phone number, all can take additional time.
  1507.  
  1508. If the software times out, the modem may, in fact, not be connected to 
  1509. the computer, disconnected, or turned off. If this is the case, enforce 
  1510. a reasonable timeout to the first setup or identification command. That 
  1511. will determine whether a modem is attached and functioning.
  1512.  
  1513. A timeout may also occur when the software receives a result code it 
  1514. does not recognize. The software may continue to wait until it receives 
  1515. a code it does recognize. If this is the case, the controller should 
  1516. proceed as if an ERROR response were received. The only instance in 
  1517. which it is not prudent to continue is when a connect (D, A, or S0) 
  1518. command was issued.
  1519.  
  1520. Before implementing a timeout, the advantages, if any, to this level of 
  1521. program interruption should be considered. For example, if the program 
  1522. times out from a dial command in one minute when it may take two minutes 
  1523. to complete the call, the timeout defeats the purpose of the command. 
  1524. The modem always responds with a result code, whether BUSY, NO CARRIER, 
  1525. or CONNECT, after some length of time.
  1526.  
  1527. Idle time is the time since data was received. Elapsed time is the time 
  1528. since the software started looking for the result. Idle time can be 
  1529. measured by resetting the timeout clock each time the software receives 
  1530. a character. Rather than exiting the loop after two seconds of elapsed 
  1531. time, the logic changes to exit after no further data has been received 
  1532. for two seconds.
  1533.  
  1534. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1535. D.8.3   Recovering when "Out Of Sync"
  1536.  
  1537. Another disadvantage of timing out is that an early timeout can put the 
  1538. software out of sync with the modem command processor. The controller 
  1539. may be interpreting results sent in response to previous commands as the 
  1540. response to later commands. To avoid this condition, any pending receive 
  1541. data should be flushed before the next command is issued.
  1542.  
  1543. ************************************************************************
  1544. D.9  Transparent XON/XOFF Local Flow Control
  1545.  
  1546. The use of flow control during error-control modem connections is 
  1547. essential to avoid loss of data during error-control protocol 
  1548. retransmissions. Use of flow control allows the DTE-DCE interface to be 
  1549. run faster than the line speed, permitting the additional benefit of 
  1550. increased throughput due to stripping of start and stop bits by the 
  1551. error control protocol and data compression techniques such as V.42bis. 
  1552. When the interface is run at high speed, data loss due to modem buffer 
  1553. overrun is quite likely to occur if flow control is absent or not 
  1554. functioning properly.
  1555.  
  1556. Hayes modems support the industry standard "RTS/CTS" hardware 
  1557. flow control (invoked by the &K3 command) and "XON/XOFF" character-based 
  1558. flow control (&K4) schemes. However, in some situations, it is not 
  1559. possible to use either of these. For example, hardware flow control 
  1560. cannot be used if the DTE serial port does not support the RTS and/or 
  1561. CTS hardware signals, if corresponding conductors are not present in the 
  1562. interface cable, or if intermediate equipment does not properly transfer 
  1563. the RTS and CTS signals. XON/XOFF flow control cannot be used if the XON 
  1564. and XOFF characters appear in the user data or in the control 
  1565. information associated with the file transfer protocol in use, since 
  1566. this would interfere with the use of these characters for flow control, 
  1567. resulting in failure of data transfer and possibly locking up the 
  1568. interface.
  1569.  
  1570. Hayes addressed these problems in the design of V-series, OPTIMA and 
  1571. ACCURA EC modems. Desiring to provide a complete solution for all users, 
  1572. Hayes provided a third flow control scheme, which accommodates systems 
  1573. which cannot use RTS/CTS but which must transfer data containing the 
  1574. XON and XOFF characters. This scheme, known as Transparent XON/XOFF 
  1575. Local Flow Control (invoked by the &K5 command), uses only the Transmit 
  1576. Data and Receive Data circuits, yet provides for the transfer of all 
  1577. 256 possible 8-bit characters over the interface without interfering 
  1578. with the flow control scheme.
  1579.  
  1580. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1581. D.9.1  Summary
  1582.  
  1583. Transparent XON/XOFF Flow Control functions on the interface between the 
  1584. local DTE (computer or terminal) and local DCE (modem). When the data is 
  1585. placed on the link between the modems, the original characters have been 
  1586. restored. Neither the remote DTE nor DCE are aware, or need to be aware, 
  1587. of the fact that Transparent XON/XOFF Flow Control is in use.
  1588.  
  1589. Transparent flow control can be viewed as a layered process, organized 
  1590. as follows. Note that this process is duplicated in the reverse 
  1591. direction (operates in both directions simultaneously).
  1592.  
  1593. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1594. D.9.2  Transparentization
  1595.  
  1596. Transparent XON/XOFF Flow Control operates by scanning the data stream 
  1597. for XON ($11), XOFF ($13), and DLE ($10) characters ("$" indicates 
  1598. hexadecimal), with either 0 or 1 in the high-order bit position. When 
  1599. one is found, a DLE with same parity character is inserted ahead of it. 
  1600. The original character is then "transparentized" by exclusive-ORing the 
  1601. character with the value $21 (hexadecimal 21, decimal 33, binary 
  1602. 00100001), which preserves the parity bit value. XON and XOFF characters 
  1603. are thus "hidden" in the data stream. 
  1604.  
  1605. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1606. D.9.3  Flow Control
  1607.  
  1608. Once the XON and XOFF characters have been transparentized (hidden), the 
  1609. DTE and DCE are free to insert XON and XOFF characters for flow control 
  1610. purposes at any point in the data stream. This includes the possibility 
  1611. of inserting XONs and XOFFs between a DLE and the following 
  1612. transparentized character. XON and XOFF characters in the user data will 
  1613. not interfere with the flow control scheme. The operation of this 
  1614. XON/XOFF flow control process is identical to traditional XON/XOFF flow 
  1615. control.
  1616.  
  1617. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1618. D.9.4  De-Transparentization
  1619.  
  1620. In the de-transparentization process, the receiving device scans for 
  1621. DLEs. When one is found, it is discarded, and the following character is 
  1622. once again exclusive-ORed with the value $21, recovering the original 
  1623. character. Note that XONs and XOFFs that appear between the DLE and the 
  1624. following transparentized character are used for flow control purposes 
  1625. and do not affect the detransparentization process.
  1626.  
  1627. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1628. D.9.5  Examples
  1629.  
  1630. The following discussion is written in terms of the actions performed by 
  1631. the computer software. The modem performs identical actions on the 
  1632. reverse directions of transmission. This text is not meant to constrain 
  1633. implementation or to imply that better implementations are not possible, 
  1634. but serves simply as an example. 
  1635.  
  1636. ........................................................................
  1637. D.9.5.1  Transmitter Example
  1638.  
  1639. Each character in the user data stream is individual examined. It it is 
  1640. any of the six characters $10, $11, $13, $90, $91, or $93, it is 
  1641. exclusive-ORed with the value $21, and prefixed by a DLE character 
  1642. ($10). This can also be viewed as a replacement function according to 
  1643. the following table:
  1644.  
  1645. Char      Replaced By
  1646. ------------------------------------------------------------------------
  1647. $10       $10 $31
  1648. $11       $10 $30
  1649. $13       $10 $32
  1650. $90       $10 $B1
  1651. $91       $10 $B0
  1652. $93       $10 $B2
  1653. ------------------------------------------------------------------------
  1654.  
  1655. The characters are transmitted using the parity setting then in force on 
  1656. the DTE-DCE interface; the XOR with $21 preserves the correct value of 
  1657. the parity bit.
  1658.  
  1659. If the software wants the modem to suspend delivering data, it inserts 
  1660. an XOFF ($13 at current parity setting) in the transmitted data stream 
  1661. at any arbitrary point, which may be between a DLE ($10) and the 
  1662. following transparentized character. The XOFF should be issued BEFORE 
  1663. the buffer is completely full, since there may be a lag of several 
  1664. characters before the modem is able to react to the XOFF and suspend 
  1665. delivery. To resume delivery of data, the software inserts an XON ($11 
  1666. at current parity setting) at any arbitrary point. Characters inserted 
  1667. for flow control purposes are NOT passed through the transparency 
  1668. algorithm defined above. 
  1669.  
  1670. ........................................................................
  1671. D.9.5.2  Receiver Example
  1672.  
  1673. Each character received from the modem is individually examined. A 
  1674. "transparency sequence in progress" flag (TSIP-FLAG) is maintained as 
  1675. part of a simple state machine. The initial value of the TSIP-FLAG is 
  1676. OFF. The following tests and actions should be undertaken in the order 
  1677. listed.
  1678.  
  1679. If the character received is $13 or $93 (XOFF with either parity), it is 
  1680. interpreted (regardless of the setting of the TSIP-FLAG) as a request 
  1681. from the modem for the DTE to suspend transmission of data to the modem. 
  1682. The receiver portion of the software must communicate this request to 
  1683. the transmitter portion of the software in a timely manner, since the 
  1684. modem has a limited amount of buffer space to allow for additional 
  1685. characters to be received after it sends XOFF (about 64 characters 
  1686. maximum). The XOFF character is discarded from the received data stream. 
  1687. The TSIP-FLAG is not changed.
  1688.  
  1689. If the character received is $11 or $91 (XON with either parity), it is 
  1690. interpreted (regardless of the setting of the TSIP-FLAG) as a request 
  1691. from the modem for the DTE to resume transmission of data to the modem, 
  1692. if any is available. The XON character is discarded from the received 
  1693. data stream. The TSIP-FLAG is not changed.
  1694.  
  1695. If the character is neither an XON or and XOFF, the following steps are 
  1696. performed:
  1697.  
  1698. If the TSIP-FLAG is ON, the received character is exclusive-ORed with 
  1699. $21, then delivered to the higher layer for further processing (e.g., 
  1700. placed in a receive data buffer). The TSIP-FLAG is then turned OFF.
  1701.  
  1702. If the TSIP-FLAG is OFF and the character received is $10 or $90 (DLE 
  1703. with either parity), the beginning of a transparency sequence is 
  1704. indicated. The DLE is discarded from the received data stream, and the 
  1705. TSIP-FLAG is turned ON. 
  1706.  
  1707. If the TSIP-FLAG is OFF and the character received is neither a $10 nor 
  1708. $90, the character is a normal untransparentized user data character 
  1709. which should be delivered to the higher layer for further processing 
  1710. (e.g., placed in a receive data buffer). The TSIP-FLAG remains OFF 
  1711. (unchanged).
  1712.  
  1713. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1714. D.9.6  Conclusion
  1715.  
  1716. When properly implemented, Transparent XON/XOFF Local Flow Control 
  1717. permits a fully-functional flow-controlled interface even when only 
  1718. three conductors are present (Transmit Data, Receive Data, and Signal 
  1719. Ground). Versatile software may use the &T19 cable test feature of Hayes 
  1720. modems to determine whether or not RTS/CTS flow control can be 
  1721. used, and, if RTS/CTS is unavailable, automatically select &K5 operation 
  1722. to use Transparent XON/XOFF flow control, and allow the user to continue 
  1723. to transfer data using any protocol or data contents without concern for 
  1724. possible interference with the XON/XOFF flow control scheme.
  1725.  
  1726. ************************************************************************
  1727. D.10     General Tips and Techniques
  1728.  
  1729. The following are tips and techniques that may help in the exchange of 
  1730. information between the software controller and the modem command 
  1731. processor.
  1732.  
  1733. *  Commands in the command line should be ordered starting with the 
  1734. safest and ending with the most risky. Risk is defined as the potential 
  1735. to generate an ERROR, causing the remainder of the command line to be 
  1736. ignored.
  1737.  
  1738. *  Any command that may return ERROR should be anticipated. This or 
  1739. other unexpected results can be ignored unless the command is critical 
  1740. (configuration or call placement).
  1741.  
  1742. *  Send I0 or I4 at 1200 bps, which is supported by the majority of 
  1743. modem products. A modem reset (&F or Z) should be performed at 1200 bps 
  1744. before sending the identification commands.
  1745.  
  1746. *  Setup processing can be speeded by sending all but the last D or S0 
  1747. command at the highest DTE rate supported by the modem. The last command 
  1748. must be sent at the speed at which the connection should be made (except 
  1749. V-series, OPTIMA and ACCURA EC products which specify this with S37).
  1750.  
  1751. *  Any dependency on proper cabling can be eliminated by avoiding 
  1752. techniques that depend on RS-232 signals:
  1753.      Have the software scan for result codes, rather than depending 
  1754.      on the condition of the CD line.
  1755.      Transparent flow control should be used with V-series, OPTIMA and 
  1756.      ACCURA EC products rather than with RTS/CTS signals.
  1757.      The escape sequence with guard time process and H command 
  1758.      should be used to hangup instead of terminate a connection by 
  1759.      dropping DTR.
  1760.      Any unexpected RING result codes may indicate the last command 
  1761.      may not have been processed correctly. The command should be-
  1762.      issued.
  1763.  
  1764. Sample Controller/Modem Exchange
  1765.  
  1766. Clock     Controller                    Speed      Modem 
  1767.                                         (1200)
  1768.                                          bps)
  1769. ------------------------------------------------------------------------
  1770. 00000     ATZ<CR>                        
  1771. 00034                                              ATZ<CR>
  1772. 00068                                             (one second to do 
  1773.                                                    reset)
  1774. 01068                                             0<CR> (V0 stored as 
  1775.                                                    default)
  1776. 01084     (delay additional 600ms)
  1777. 01684     ATEQV1S0=0S12=10S4=3HI<CR>          
  1778. 01884                                             ATEQV1S0=0S12=10S4=3HI
  1779.                                                   <CR> (echo)
  1780. 02084                                             <CR><LF>960<CR><LF> 
  1781. 02142                                             <CR><LF>OK<CR><LF>
  1782.                                          (19200
  1783.                                           bps)     
  1784. 02192     ATM0X4L1S12=10S2=1&Q5W1S36
  1785.           =7S37=9&K5<CR>
  1786. 02206                                             <CR><LF>OK<CR><LF> 
  1787. 02209     ATDT9W14045551212<CR>
  1788. 38000                                             <CR><LF>CARRIER 
  1789.                                                   2400<CR><LF>
  1790. 45000                                             <CR><LF>PROTOCOL: 
  1791.                                                   NONE<CR><LF>
  1792. 45010                                             <CR><LF>CONNECT 
  1793.                                                   2400<CR><LF>
  1794.                                         (2400 
  1795.                                         bps)
  1796.                                         
  1797. (Connection Established)
  1798. -----------------------------------------------------------------------
  1799.                                         (2400 
  1800.                                          bps)
  1801. 00000     (delay 300ms, need 200, add 
  1802.           100 for safety)
  1803. 00300     (escape char is ^A, S2=1)
  1804. 00313                                              (waits 200ms)
  1805. 00513                                              <CR><LF>OK<CR><LF>
  1806. 00538     ATHE1S2=43S12=50W0&Q0<CR>
  1807. 00630                                              <CR><LF>OK<CR><LF> 
  1808. ------------------------------------------------------------------------
  1809.  
  1810. ========================================================================
  1811.